package com.ruoyi.bizsys.service.impl;

import java.util.List;
import java.util.Arrays;
                                                                                            import com.ruoyi.common.utils.DateUtils;
            import org.springframework.stereotype.Service;
    import com.ruoyi.bizsys.mapper.CustReduceDataMapper;
import com.ruoyi.bizsys.domain.CustReduceData;
import com.ruoyi.bizsys.service.ICustReduceDataService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;


/**
 * 客户减免次数Service业务层处理
 *
 * @author wqg
 * @date 2022-04-07
 */
@Service
public class CustReduceDataServiceImpl extends ServiceImpl<CustReduceDataMapper,CustReduceData> implements ICustReduceDataService {

    /**
     * 查询客户减免次数
     *
     * @param custNo 客户减免次数ID
     * @return 客户减免次数
     */
    @Override
    public CustReduceData selectCustReduceDataById(String custNo) {
        return this.getById(custNo);
    }

    /**
     * 查询客户减免次数列表
     *
     * @param custReduceData 客户减免次数
     * @return 客户减免次数
     */
    @Override
    public List<CustReduceData> selectCustReduceDataList(CustReduceData custReduceData) {
        return this.list(new QueryWrapper<>(custReduceData).last("order by id desc"));
    }

    /**
     * 新增客户减免次数
     *
     * @param custReduceData 客户减免次数
     * @return 结果
     */
            @Override
    public int insertCustReduceData(CustReduceData custReduceData) {
                                                                                                                                                            custReduceData.setCreateTime(DateUtils.getNowDate());
                                                                                        return baseMapper.insert(custReduceData);
    }

    /**
     * 修改客户减免次数
     *
     * @param custReduceData 客户减免次数
     * @return 结果
     */
            @Override
    public int updateCustReduceData(CustReduceData custReduceData) {
                                                                                                                                                                                                    custReduceData.setUpdateTime(DateUtils.getNowDate());
                                                return baseMapper.updateById(custReduceData);
    }

    /**
     * 批量删除客户减免次数
     *
     * @param custNos 需要删除的客户减免次数ID
     * @return 结果
     */
            @Override
    public int deleteCustReduceDataByIds(String[] custNos) {
        return baseMapper.deleteBatchIds(Arrays.asList(custNos));
    }

    /**
     * 删除客户减免次数信息
     *
     * @param custNo 客户减免次数ID
     * @return 结果
     */
    @Override
    public int deleteCustReduceDataById(String custNo) {
        return baseMapper.deleteById(custNo);
    }

}
